<template>
    <div></div>
</template>

<script lang="ts">
import Taro, { useRouter } from '@tarojs/taro';
import { reactive, toRefs, onMounted } from 'vue';
import { requirePlugin } from '@tarojs/taro';
import { getWaybillToken } from './../../../../api/index'
export default {
    components: {

    },
    setup() {
        const myPluginInterface = requirePlugin('logisticsPlugin')
        const data = reactive({
            token: ''
        });

        onMounted(() => {
            const router = useRouter();
            if (router.params.orderNo) {
                getWaybillToken(router.params.orderNo).then(res => {
                    if (res.resultCode == 200) {
                        data.token = res.message
                        myPluginInterface.openWaybillTracking({
                            waybillToken: res.message
                        });
                    }
                })
            }
        })
        return {
            ...toRefs(data),
        }
    }
};
</script>
<style lang="scss"></style>